﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using SR.ExpressionEvaluator.Lib;

namespace SR.ExpressionEvaluator
{
    public partial class MainPage : UserControl
    {

        IEvaluator eval;

        public MainPage()
        {
            InitializeComponent();

            this.eval = Factory.GetEvaluator();
            this.eval.Variables.Add("IS_DOB", new DateTime(1980, 2, 14));
            this.eval.Variables.Add("IS_NAME", "Shishir");
            this.eval.Variables.Add("IS_PREM", 1000);

            Application.Current.UnhandledException += new EventHandler<ApplicationUnhandledExceptionEventArgs>(Current_UnhandledException);
        }

        void Current_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
        {
            
        }

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            txtOutput.Text = this.eval.Evaluate<object>(txtInput.Text).ToString();
        }
    }
}
